package com.heatingcharge.controller.charge;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.heatingcharge.common.util.R;
import com.heatingcharge.dto.CustomerDTO;
import com.heatingcharge.entity.charge.ChargePayable;
import com.heatingcharge.param.SearchParam;
import com.heatingcharge.service.charge.IChargePayableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 年度应收 前端控制器
 * </p>
 *
 * @author devin.jiang
 * @since 2019-10-31
 */
@RestController
@RequestMapping("/charge-payable")
public class ChargePayableController {
    @Autowired
    IChargePayableService chargePayableService;

    /**
     * 获取指定住户的年度应缴信息
     * @return
     */
    @GetMapping("/house/{id}")
    public R getChargePayable(@PathVariable("id") Integer id){
        SearchParam searchParam = SearchParam.builder()
                .houseId(id)
                .build();
        return R.ok(chargePayableService.getChargePayable(searchParam));
    }

    /**
     * 生成年度应缴信息
     * @param searchParam
     * @return
     */
    @GetMapping("/generate")
    public R save(SearchParam searchParam){
        return R.ok(chargePayableService.save(searchParam));
    }

}

